# -*- coding: utf-8 -*-
"""
 @Time    : 2021/2/4 下午3:23
 @Author  : tgy
 
"""

"""

数据描述符: 类中包含 __get__ 和 __set__ 方法
非数据描述符: 类中只包含 __get__

"""


class Method:
    ...
    def __init__(self,val):
        self.val = val

    def __set__(self, instance, value):
        ...
        print('__set__')
        self.val = value

    def __get__(self, instance, owner):
        print('__get__')
        return self.val




class Person(object):

    # 描述实例设置为类的属性才有其作用
    x = Method(0)

    @classmethod
    def run(cls):
        ...

    # run = staticmethod(run)

    def test(self):
        ...

def test01():
    ...
    person = Person()

    print(Person.__mro__)
    person.x = 12
    print(person.x)
    print(vars(person))
    person.run()
    print(person.test.__self__)

if __name__ == '__main__':
    ...
    test01()